import caches from '@/config/caches.js'
const mutations = {
	// 正常 token
	SET_TOKEN(state, payload) {
		state.token = payload;
		uni.setStorageSync(caches.ACCESS_TOKEN, payload);
	},
	SET_TOKEN_CUSTOMER(state, payload) {
		//有些业务场景业务员需要用到   客户端  token（所以业务员登录也会拿到客户端token）
		state.customer_token = payload
		uni.setStorageSync(caches.CUSTOMER_TOKEN, payload);
	},
	// 设置健康平台token(现目前只针对客户账号登录的时候设置，也就是说：如果登录的账号是客户账号同时也要登录健康平台的账号)
	SET_TOKEN_HEALTH_PLATFORM(state, payload) {
		state.health_platform_token = payload
		uni.setStorageSync(caches.HEALTH_PLATFORM_TOKEN, payload);
	},
	// 设置权益卡token(现目前只针对客户账号登录的时候设置，也就是说：如果登录的账号是客户账号同时也要登录权益卡的账号)
	SET_TOKEN_Benefit_Card(state, payload) {
		state.benefit_card_token = payload
		uni.setStorageSync(caches.Benefit_Card_TOKEN, payload);
	},
	SET_PHONE(state, payload) {
		state.phone = payload;
		uni.setStorageSync(caches.PHONE, payload);
	},
	SET_TENDID(state, payload) {
		state.tendId = payload;
		uni.setStorageSync(caches.TENDID, payload);
	},
	SET_AUTHORITY(state, payload) {
		state.authority = payload;
		uni.setStorageSync(caches.AUTHORITY, payload);
	},
	SET_FROMSHAREID(state, payload) {
		state.fromshareId = payload;
		uni.setStorageSync(caches.FROMSHAREID, payload);
	},
	SET_INVITE_OPTIONS(state, payload) {
		
		
		state.inviteLogin = payload;
		// uni.setStorageSync('inviteLogin', payload);
	},
	SET_FROMSHARECHICKENID(state, payload) {//仓库得鸡分享关联
		state.fromshareChickenId = payload;
		uni.setStorageSync(caches.FROMSHARECHICKENID, payload);
	},
	SET_FROMVIPSHAREID(state, payload) {//成为会员推荐人
		state.fromvipshareId = payload;
		uni.setStorageSync(caches.FROMVIPSHAREID, payload);
	},
	SET_MEMBERFLAG(state, payload) {//是否是会员
		state.memberFlag = payload;
		uni.setStorageSync(caches.MEMBERFLAG, payload);
	},
	SET_SHOW_PHONE_NUMBER(state, payload) {
		state.showGetPhoneNumber = payload
	},
	SET_SHOW_CHOOSE_AVATAR(state, payload) {
		state.showChooseAvatar = payload
	},
	SET_USER_PROFILE(state, payload) {
		state.userProfileData = payload
	},
	SET_LOGIN_CODE(state, payload) {
		state.loginCode = payload
		uni.setStorageSync(caches.LOGIN_CODE, payload);
	},
	SET_PHONE_NUMBER_DETAIL(state, payload) {
		state.phoneNumberDetail = payload
		uni.setStorageSync(caches.PHONE_NUMBER_DETAIL, payload);
	},
	SET_USERINFO(state, payload) {
		state.userInfo = payload
		state.isLogin = true
		uni.setStorageSync(caches.ISLOGIN, true)
		uni.setStorageSync(caches.USER_INFO, payload);
	},
	SET_HEALTH_PLATFORM_USERINFO(state, payload) {
		state.userInfoHealthPlatform = payload;
		uni.setStorageSync(caches.USER_INFO_HEALTH_PLARFORM, payload)
	},
	SET_LOGOUT(state, payload) {
		state.isLogin = false
		uni.setStorageSync(caches.CURRENT_TAB_NAME, 0)
		state.tabName = 0;
		state.userInfo = null
		state.userInfoHealthPlatform = null
		state.addressList = []
		state.authority = "customer"
		state.health_platform_token = ""
		state.benefit_card_token = ""
		uni.clearStorageSync()

	},
	SET_REPORT_TOKEN(state, payload) {
		state.reportToken = payload
		uni.setStorageSync(caches.REPORT_TOKEN, payload);
	},
	SET_ADDRES_LIST(state, payload) {
		state.addressList = payload
	},
	SET_REPORT_INFO(state, payload) {
		state.reportInfo = payload
		uni.setStorageSync(caches.REPORT_INFO, payload);
	},
	REMOVE_REPORT_TOKEN(state, payload) {
		state.reportToken = ''
		uni.removeStorageSync(caches.REPORT_TOKEN);
	},
	REMOVE_REPORT_INFO(state, payload) {
		state.reportInfo = ''
		uni.removeStorageSync(caches.REPORT_INFO);
	},
	SET_VIDEO(state, payLoad) {
		state.showVideo = payLoad
	},
	SET_CURRENT_TAB_INDEX(state, payload) {
		state.tabName = payload
		uni.setStorageSync(caches.CURRENT_TAB_NAME, payload)
	},
}

export default mutations